
#include	<string.h>
#include	<unistd.h>
#include	<stdlib.h>
#include	<sys/types.h>
#include	<sys/stat.h>
#include	<fcntl.h>

int		main(int ac, char **av)
{
  int		error;
  int		fd;
  int		len;
  char		buff[512];

  fd = open("toto", O_RDWR);
  error = dup2(fd, 0);
  if (error == -1)
    {
      write(2, "Dup2 failed\n", strlen("Dup2 failed\n"));
      exit(EXIT_FAILURE);
    }
  len = read(0, buff, 511);
  write(1, buff, len);
  return (EXIT_SUCCESS);
}
